package main
import(
	//"gutility"
	"fmt"
	"time"
	"sync"
)


func errorHandler(err error) {
  if err != nil {
    fmt.Println(err.Error())
  }
}

func main(){
	var num = 0
    var locker sync.Mutex

    for i := 0; i < 100000; i++ {
        go func(i int) {
            locker.Lock()
            defer locker.Unlock()

            num++
            fmt.Printf("goroutine %d: num = %d\n", i, num)
        }(i)
    }

    time.Sleep(time.Second)
}